home *** CD-ROM | disk | FTP | other *** search
- Path: news.sni.de!news
- From: Josef Moellers <mollers.pad@sni.de>
- Newsgroups: comp.lang.c
- Subject: Re: char* still alive after free ???
- Date: 16 Apr 1996 06:56:36 GMT
- Organization: Siemens Nixdorf Informationssysteme AG, Paderborn, Germany
- Message-ID: <4kvgb4$3vt@nervous.pdb.sni.de>
- References: <317269EA.11BB93C2@studbox.uni-stuttgart.de> <829591931snz@genesis.demon.co.uk>
- NNTP-Posting-Host: uranium.pdb.sni.de
- X-Newsreader: NN version 6.5.0 #2
-
- In <829591931snz@genesis.demon.co.uk> Lawrence Kirby <fred@genesis.demon.co.uk> writes:
-
- >>free(text); text=NULL; and finally a
-
- >The text = NULL; is redundant.
-
- It's NOT redundant! It would be if "free(text)" would set "text" to
- NULL, but since arguments are passed by value in C, this is unlikely.
-
- If you'd chased as many bugs that use free'd memory as I did, you'd be
- gratefull for every "ptr = NULL" people write. These bugs have
- disastrous results and are extremely hard to trace!
-
- Happy clearing,
-
- Josef
- --
- Josef Moellers work: mollers.pad@sni.de
- home: josef@firefox.pb.owl.de
-